﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Configuration;

namespace CNTVNow.Web.Helpers.Common
{
    public class Config
    {
        /*Number record*/
        public static int NewsTopNumber()
        {
            return int.Parse(ConfigurationManager.AppSettings["NewsTopNumber"].ToString());
        }
        public static int NewsUnderTopNumber()
        {
            return int.Parse(ConfigurationManager.AppSettings["NewsUnderTopNumber"].ToString());
        }
        public static int NewsLatestNumber()
        {
            return int.Parse(ConfigurationManager.AppSettings["NewsLatestNumber"].ToString());
        }
        public static int NewsLeftNumber()
        {
            return int.Parse(ConfigurationManager.AppSettings["NewsLeftNumber"].ToString());
        }
        public static int NewsMiddleNumber()
        {
            return int.Parse(ConfigurationManager.AppSettings["NewsMiddleNumber"].ToString());
        }
        /*Number record News*/
        public static int NewsTopNumber(int menuId, int parentId)
        {
            if (parentId != 0) return int.Parse(NewsNumber.NewsNumberInstance["top_" + parentId].ToString());
            return int.Parse(NewsNumber.NewsNumberInstance["top_" + menuId].ToString());
        }
        public static int NewsUnderTopNumber(int menuId, int parentId)
        {
            if (parentId != 0) return int.Parse(NewsNumber.NewsNumberInstance["under_" + parentId].ToString());
            return int.Parse(NewsNumber.NewsNumberInstance["under_" + menuId].ToString());
        }
        public static int NewsLatestNumber(int menuId, int parentId)
        {
            if (parentId != 0) return int.Parse(NewsNumber.NewsNumberInstance["last_" + parentId].ToString());
            return int.Parse(NewsNumber.NewsNumberInstance["last_" + menuId].ToString());
        }
        public static int NewsLeftNumber(int menuId, int parentId)
        {
            if (parentId != 0) return int.Parse(NewsNumber.NewsNumberInstance["left_" + parentId].ToString());
            return int.Parse(NewsNumber.NewsNumberInstance["left_" + menuId].ToString());
        }
        public static int NewsMiddleNumber(int menuId, int parentId)
        {
            if (parentId != 0) return int.Parse(NewsNumber.NewsNumberInstance["mid_" + parentId].ToString());
            return int.Parse(NewsNumber.NewsNumberInstance["mid_" + menuId].ToString());
        }

        /*Flag in database NewsPosition*/
        public static int PositionTopBanner()
        {
            return int.Parse(ConfigurationManager.AppSettings["PositionTopBanner"].ToString());
        }
        public static int PositionUnderTopBanner()
        {
            return int.Parse(ConfigurationManager.AppSettings["PositionUnderTopBanner"].ToString());
        }
        public static int PositionLatestNews()
        {
            return int.Parse(ConfigurationManager.AppSettings["PositionLatestNews"].ToString());
        }
        public static int PositionLeftNews()
        {
            return int.Parse(ConfigurationManager.AppSettings["PositionLeftNews"].ToString());
        }
        public static int PositionMiddleNews()
        {
            return int.Parse(ConfigurationManager.AppSettings["PositionMiddleNews"].ToString());
        }
        /*Max Ads*/
        public static int AdsMax()
        {
            return int.Parse(ConfigurationManager.AppSettings["AdsMax"].ToString());
        }
        public static int CommentMax()
        {
            return int.Parse(ConfigurationManager.AppSettings["CommentMax"].ToString());
        }
    }
}